package Demo4;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

@Component
public class Person {
    @Autowired
    /**
     * 自动装配时发现多个可以装配的类时，使用@Qualifier指定
     */
    @Qualifier("winter")


    //private Shirt shirt;
    private Clothes clothes;//面向接口，人需要衣服，不是具体的某种衣服

    @Autowired
    private Sweater sweater;

    @Override
    public String toString() {
        return "Person{" +
                "clothes=" + clothes +
                '}';
    }
}
